package chp07;

public class Test11 {

    public static void main(String[] args) {
        int[] nums = {34,56,2,78,12};
        //找最大值
//        Arrays.sort(nums);
//        System.out.println(nums[nums.length-1]);
        //以数组的首位初始化最大值
        int max = nums[0];
        for (int i = 0; i < nums.length; i++) {
            if(nums[i] > max){
                max = nums[i];
            }
        }
        System.out.println("最大值:" + max);
    }
}
